package com.example.lenovo.wechattest;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;

import java.util.ArrayList;
import java.util.List;

public class WeChatFragment extends Fragment {

    private List<com.example.lenovo.wechat.Chat> chatList = new ArrayList<>();

    private ViewGroup mContainer;

    private Button mBtnSend;
    private EditText mEdMessage;

    public WeChatFragment() {
        // Required empty public constructor
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_we_chat, container, false);

        RecyclerView recyclerView = view.findViewById(R.id.chat_recyclerview);
        recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
        chatList.add(new com.example.lenovo.wechat.Chat(R.mipmap.head1, "会话1"));
        chatList.add(new com.example.lenovo.wechat.Chat(R.mipmap.head2, "会话2"));
        chatList.add(new com.example.lenovo.wechat.Chat(R.mipmap.head3, "会话3"));

        ChatAdapter adapter = new ChatAdapter(getActivity(), chatList);
        recyclerView.setAdapter(adapter);
        return view;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

//        mBtnSend = mContainer.findViewById(R.id.btn_send);
    }
}
